package com.taikang.hmp.hbusiness.diabetes.measure.guide.action.view;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.taikang.hmp.frame.common.TKException;
import com.taikang.hmp.frame.common.datastructre.Dto;
import com.taikang.hmp.frame.common.datastructre.support.BaseDto;
import com.taikang.hmp.frame.common.datastructre.support.ResponseDto;
import com.taikang.hmp.frame.common.web.action.BaseAction;
import com.taikang.hmp.hbusiness.diabetes.measure.guide.service.IGuideService;

/** 
 * 指导
 * author:qrp
 * time:2015年12月14日 上午10:56:46
 */
public class GuideViewAction extends BaseAction{
	private static final long serialVersionUID = 1L;
	private static Logger logger = LoggerFactory.getLogger(GuideViewAction.class);
	
	private IGuideService guideService;

	public IGuideService getGuideService() {
		return guideService;
	}

	public void setGuideService(IGuideService guideService) {
		this.guideService = guideService;
	}
	
	public String executeAction() {
		if ("getGuidance".equals(requestDto.getMethod())) { 
			logger.info("--【获取健康指导列表】: method getGuidanceList --");
			return getGuidance();
		} else {
			logger.info("executeAction 里没有配置"+ requestDto.getMethod() +"方法!");
			throw new TKException("no support method:" + requestDto.getMethod());
		}
	}
	
	/**
	 * 获取健康指导详情
	 * @return
	 */
	public String getGuidance(){
		ResponseDto responseDto = new ResponseDto();
		//获取参数
	    Dto paramDto = requestDto.getRequestlist().get(0);
	    paramDto = super.appendRequestBase(paramDto, requestDto);
	    
	    Dto result = guideService.getGuidance(paramDto);	
	    
		//
	
		Dto resultDto = new BaseDto();
		resultDto.put("resultlist",result);
		responseDto.pushResultDto(resultDto);
		
		super.setDataMap(responseDto);
		return SUCCESS;
	}
	
}
